#ifndef _CAMERA_PHOTO_
#define _CAMERA_PHOTO_

#include "../stdafx.h"
#include "../base/Base.h"

class CCamera;

class CPhoto
{
public:
	CPhoto();
	CPhoto(CCamera* pCamera);
	CPhoto(CString imageName);
	CPhoto(const CPhoto &photo);
	~CPhoto();

	void SetCamera(CCamera* pCamera);
	void SetImage(CString imageName);
	void Pixel2GlobalPoint3D(CPixel pixel, CPoint3D &p3D);
	void GlobalPoint3D2Pixel(CPoint3D p3D, CPixel &pixel);
	void Pixel2Color(CPixel pixel, CColor &color);
	void Pixel2Color(int x, int y, int &r, int &g, int &b);
	void GlobalPoint3D2Color(CPoint3D p3D, CColor &color);
	void CameraPoint3D2GlobalPoint3D(CPoint3D cameraPoint, CPoint3D &gloPoint);
	void GlobalPoint3D2CameraPoint3D(CPoint3D gloPoint, CPoint3D &cameraPoint);

	void CalcExtrinsicParas(vector<CPixel> pixels, vector<CPoint3D> p3Ds);

	int GetHeight();
	int GetWidth();

	IplImage* GetImage() {return m_image;}

	void SetPixelColor(int x, int y, int r, int g, int b);

	void SavePhoto(char* filename);

protected:
	IplImage* m_image;
	CvMat* m_rotationVector;
	CvMat* m_translationVector;

	CCamera* m_pCamera;
	CPoint3D m_cameraPosition;
};

#endif